<?php
// +----------------------------------------------------------------------
// | EasyAdmin
// +----------------------------------------------------------------------
// | PHP交流群: 763822524
// +----------------------------------------------------------------------
// | 开源协议  https://mit-license.org 
// +----------------------------------------------------------------------
// | github开源项目：https://github.com/zhongshaofa/EasyAdmin
// +----------------------------------------------------------------------
namespace app\model\api;

use laytp\BaseModel;
use laytp\library\Tree;
use think\model\concern\SoftDelete;

class WorldCategory extends BaseModel
{
    protected $name = 'world_category';


    /**
     * 分类列表
     * @return array
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function list(){
        $list = $this
            ->order('id asc')
            ->cache(true)
            ->select()
            ->toArray();

        $menuTreeObj = Tree::instance();
        $menuTreeObj->init($list);
        $data = $menuTreeObj->getRootTrees();

        return $data;
    }

    

}